package com.kuangchi.faiss.utils;

public class FaissJni {
	static {
		System.loadLibrary("faiss");
		System.loadLibrary("faiss_jni");
	}
    public static native long readIndexJNI(String indexFilePath);
    public static native long indexFlatIPJNI(long dim);
    public static native long indexIVFFlatJNI(long dim, long nlist, long nprobe);
    public static native long indexIVFPQJNI(long dim, long nlist, long m, long nbits);
    public static native void trainJNI(long indexIVFAddr, long nlist, float[] features);
    public static native void addJNI(long indexAddr, long nlist, float[] features);
    public static native void writeIndexJNI(long indexAddr, String indexFilePath);
    public static native String searchJNI(long indexAddr, long querysCount, float[] querys, long topK);
    public static native void addWithIdsJNI(long indexAddr, long nlist, float[] features, long[] ids);
    public static native void removeIdsJNI(long indexAddr, long[] removeIds);
    public static native void freeJNI(long indexAddr);

}
